#!/bin/sh

# install logrotated and s3uploadfile scripts in /usr/local/bin
install s3logrotated s3uploadfile /usr/local/bin

#add s3logrotate to the server rc*.d scripts
install  s3logrotate /etc/init.d
update-rc.d s3logrotate defaults

if [ -f /etc/s3logarchiver.conf ]; then exit 0;fi

# Create /etc/s3logarchiver.conf
BUCKETID=$1
ARCHIVETAG=$2
if [ -z $1 ] ; then BUCKETID="s3://your-bucket-here"; fi
if [ -z $2 ] ; then ARCHIVETAG=$(hostname);fi

cat << EOT > /etc/s3logarchiver.conf
#!/bin/sh
export BUCKETID="$BUCKETID"
export ARCHIVETAG="$ARCHIVETAG"
EOT
